using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.Skins;
using DevExpress.LookAndFeel;
using DevExpress.UserSkins;
using DevExpress.XtraEditors;
using DevExpress.XtraRichEdit.API.Native;
using DevExpress.XtraRichEdit;
using DevExpress.XtraBars.Helpers;
using System.IO;
using SyntaxEditor;


namespace WindowsApplication1
{
    public partial class Form1 : XtraForm
    {
        public Form1()
        {
            InitializeComponent();
            InitSkinGallery();
        }
        void InitSkinGallery()
        {
            SkinHelper.InitSkinGallery(rgbiSkins, true);
        }

        private void iOpen_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            openFileDialog1.Filter = "c files (*.c) | *.c| cpp files (*.cpp)|*.cpp";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
               // richEditControl.LoadDocument(openFileDialog1.FileName, DocumentFormat.PlainText);
                /*
                using (Stream stream = GetResourceStream(openFileDialog1.FileName))
                {
                    StreamReader fs = new StreamReader(openFileDialog1.FileName);
                    //TextReader sr = new TextReader();
                    while (fs.EndOfStream)
                    {
                        richEditControl.Text += fs.ReadToEnd();

                    }
                }
                */
                
            }
            
        }

        private void iSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            saveFileDialog1.Filter = "c files (*.c) | *.c| cpp files (*.cpp)|*.cpp";
            if(saveFileDialog1.ShowDialog()==DialogResult.OK)
            {
               // richEditControl.SaveDocument(saveFileDialog1.FileName, DocumentFormat.PlainText);
            }
        }

        private void iSaveAs_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            saveFileDialog1.Filter = "c files (*.c) | *.c| cpp files (*.cpp)|*.cpp";
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {

               // richEditControl.SaveDocument(saveFileDialog1.FileName, DocumentFormat.PlainText);
            }
        }

        private void iNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            xtraTabControl1.TabPages.Add("new" + xtraTabControl1.TabPages.Count);
          //  SyntaxEditor 
           // this.editor1 = new SyntaxEditor.Editor();
        }
    }
}